#include <sys/syscall.h>
#include <sys/types.h> 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>                     
#include <errno.h>                   
#include <fcntl.h>


int main(int argc, char *argv[])
{

    pid_t pid;
  
    char * prog = "childtest";
    char * arg = NULL;
  
    char * args_n[3];
  
    args_n[0] = prog;
    args_n[1] = arg;
    args_n[2] = NULL;
  
    execv(argv[2], args_n);
  
    pid = fork();
    
    if(pid==0){
        execv("childtest", args_n);
        _exit(0);
     }else if(pid == -1){
         printf("Unable to fork\n");
         exit(0);
      }else{
          open("parenttest.txt", O_RDONLY);
          printf("parent\n");
          wait();
          exit(0);
       } 
}